num = 0
count = 1

for i in range(1, 11):
    count = count * i
    num += count

print("1到10的阶乘之和为", num)


num = 0

for i in range(1, 101):
    if i % 2 == 0:
        num += i
print("1加到100的和为 ", num)


string = input("输入一个正整数")
print( string[::-1])


str_int = int(input("输入一个正整数"))

int_str = str(bin(str_int))

count = 0
for i in int_str[2: :]:
    if i == '1':
        count += 1

print(f"{str_int} 的二进制为 {int_str[2: :]},有 {count} 个1")

def age(n):
    if n == 1:
        return 10
    else:
        return age(n-1) + 2


print(f"第5个人{age(5)} 岁")


# 百钱买百鸡
for i in range(20):
    for j in range(35):
        for k in range(100):
            if i + j + k * 3 == 100:
                if i * 5 + j * 3 + k == 100:
                    print(f"买{i} 只公鸡，{j} 只母鸡，{k * 3} 小鸡")


